package org.codeart.decorator.loader;

import cn.hutool.core.io.FileUtil;

import java.nio.charset.StandardCharsets;

public class BaseFileDataLoader implements DataLoader {
    
    private final String filePath;

    public BaseFileDataLoader(String filePath) {
        this.filePath = filePath;
    }

    @Override
    public String read() {
        return FileUtil.readString(filePath, StandardCharsets.UTF_8);
    }

    @Override
    public void write(String data) {
        FileUtil.appendString(data, filePath, StandardCharsets.UTF_8);
    }
}
